package com.ccut.xunfeiSpringboot.constant;

import lombok.Getter;

@Getter
public enum Degree {
    ASSOCIATE(1, "专科"),
    BACHELOR(2, "本科"),
    MASTER(3, "硕士研究生"),
    DOCTORAL(4, "博士研究生");

    private final int value;
    private final String description;

    Degree(int value, String description) {
        this.value = value;
        this.description = description;
    }

    // 根据整数值获取对应的枚举实例
    public static Degree fromValue(int value) {
        for (Degree degree : Degree.values()) {
            if (degree.getValue() == value) {
                return degree;
            }
        }
        throw new IllegalArgumentException("Invalid degree value: " + value);
    }

    @Override
    public String toString() {
        return description;
    }
}
